home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
BUS
/
TMCM Software and Labs.sit
/
Software for TMCM 7_95
/
Files for Lab 13
/
Circles
< prev
next >
Wrap
Text File
|
1995-07-08
|
1KB
|
34 lines
{
A program that illustrates multiple levels of
forking. One turtle splits into 10, then each
of those 10 turtles splits into 10. This gives
a total of 100 turtles. Each turtle draws a
circle.
}
PenUp
MoveTo(-5,-5)
fork(10) { Split into 10 turtles. }
declare row { Each turtle creates its OWN variable named "row" }
row := ForkNumber { Save the value of ForkNumber in row. }
fork(10) { Each turtle splits into 10 new turtles. }
declare column { Each of the 100 turtles has a "column" variable, }
column := ForkNumber { which is set equal to ForkNumber. }
{ Note: The variable column is not really }
{ necessary, since ForkNumber could be }
{ used directly. I am using column only }
{ for readability. }
forward(column) { Turtles spread out along a horizontal line. }
face(90)
forward(row) { Turtles spread out along a vertical line. }
PenDown
circle(1) { Each of the 100 turtled draws a circle }
{ of radius 1. }